<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
         /*
                 *
                ***
               ******
              ********
             **********

             **********
              ********
               ******
                ***
                 *
        */
        let sum= prompt('输入星星列数');
        for (let i = 1; i <= sum; i++) {
            let star = "";
            for (let j = 1; j <= sum- i; j++) {
                star = star + " ";
            }
            for (let j = 1; j <= i*2-1; j++) {
                star = star + "*";
            }
            console.log(star);
        }
        let sum1= prompt('输入星星列数');
        for (let i = sum1; i >= 1; i--) {
            let star = "";
            for (let j = sum1- i; j >= 1; j--) {
                star = star + " ";
            }
            for (let j = i*2-1; j >= 1; j--) {
                star = star + "*";
            }
            console.log(star);
        }
        /* 
            1111*
            111**
            11***
            1****
            *****
            11111
            1111
            111
            11
            1
            *
            **
            ***
            ****
            *****
        */

       let num= prompt('输入星星列数');
        for (let i = 1; i <= num; i++) {
            let star = "";
            for (let j = 1; j <= num- i; j++) {
                star = star + " ";
            }
            for (let j = 1; j <= i; j++) {
                star = star + "*";
            }
            console.log(star);
        }
    </script>
</body>
</html>